import 'package:flutter/material.dart';
import 'package:leader_help/global/user/logic.dart';
import 'package:leader_help/utils/util.dart';
import 'package:get/get.dart';
import '../controller.dart';

class HomeInfoView extends GetView<HomeController> {
  HomeInfoView({Key? key}) : super(key: key);
  final userCtrl = Get.find<UserController>();
  @override
  Widget build(BuildContext context) {
    return Container(
      padding:
          EdgeInsets.fromLTRB(30.r, SizeFit.statusBarHeight + 15.r, 10.r, 15.r),
      child: Obx(
        () => Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            loadImage(
                url: userCtrl.state.userObs.value.avater,
                width: 50.r,
                height: 70.r),
            SizedBox(
              width: 10.r,
            ),
            SizedBox(
              width: 96.r,
              height: 70.r,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    userCtrl.state.userObs.value.name ?? '',
                    style: pfMediumStyle(color: Colors.white, fontSize: 16.sp),
                  ),
                  Flexible(
                    child: Text(
                      userCtrl.state.userObs.value.post ?? '',
                      maxLines: 2,
                      overflow: TextOverflow.fade,
                      style:
                          pfMediumStyle(color: Colors.white, fontSize: 13.sp),
                    ),
                  )
                ],
              ),
            ),
            SizedBox(
              width: SizeFit.screenWidth / 2 - 20.r,
              child: Wrap(
                spacing: 10.r,
                runSpacing: 10.r,
                alignment: WrapAlignment.end,
                children: controller.state.slogans.value
                    .map(
                      (e) => Text(
                        e,
                        style: pfMediumStyle(
                            color: const Color(0xb2ffffff), fontSize: 15.sp),
                      ),
                    )
                    .toList(),
              ),
            )
          ],
        ),
      ),
    );
  }
}
